package Task11;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = getLCA(a,b);
        System.out.println(c);
    }

    private static int getLCA(int a, int b) {
      while ( a != b){
          if(a > b){
              a /= 2;
          }else {
              b /= 2;
          }
      }
      return a;
    }
}
